package com.dongdong.index;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdong.pojo.TbContentCategory;
import com.dongdong.pojo.TbTypeTemplate;
import com.dongdong.service.ContentCategoryService;
import com.dongdong.service.TypeTemplateService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {

    @Reference
    private TypeTemplateService typeTemplateService;

    @Reference
    private ContentCategoryService contentCategoryService;

    @RequestMapping("index")
    public String index(){
        return "login";
    }

    @RequestMapping("andmin")
    public String andmin(){
        return "admin/index";
    }

    @RequestMapping("item")
    public String item(Model m){
        List<TbTypeTemplate> tbTypeTemplates  = typeTemplateService.selecta();
        m.addAttribute("tbTypeTemplates",tbTypeTemplates);
        return "admin/item_cat";
    }

    @RequestMapping("seller")
    public String seller(){
        return "admin/seller";
    }

//    商家审核
    @RequestMapping("goods")
    public String goods(){
        return "admin/goods";
    }

//    广告类型管理
    @RequestMapping("contentCategory")
    public String contentCategory(){
        return "admin/content_category";
    }

//    广告管理
    @RequestMapping("content")
    public String content(Model m){
        List<TbContentCategory> contentCategories = contentCategoryService.selectAll();
        m.addAttribute("contentCategories",contentCategories);
        return "admin/content";
    }

}
